#ifndef FKMENUINTERFACE_H
#define FKMENUINTERFACE_H

#include "FKVisualInterface.h"

#include <QStringList>
#include <QVariant>

class QStringListModel;
class FKQuickRowModel;
class FKAppVersionModel;
class QSortFilterProxyModel;

class FKVISUALINTERFACESHARED_EXPORT FKMenuInterface:public FKVisualInterface{
    Q_OBJECT
    Q_PROPERTY(QStringList avaliableRooms READ avaliableRoomTypes NOTIFY avaliableRoomsChanged)
public:
    FKMenuInterface(QObject* parent=0);
    ~FKMenuInterface();
    QStringList avaliableRoomTypes()const{return _avaliableRoomTypes;}
    void setAvaliableRoomTypes(const QStringList& lst);
    void addLang(QString lng, QString lngLbl);
    void toLangMenu();
    void toMainMenu();
    void fromMainMenu();
    void toClientMenu();
    void fromClientMenu();
    void toUserMenu();
    void fromUserMenu();
    void toRoomList();
    void fromRoomList();
    void toAppUpdateMenu();
    void fromAppUpdateMenu();
    void setUpdateFilesList(QStringList files,
                                     QList<quint8> osTypes,
                                    QStringList serverVersions,
                                    QList<qint64> serverWeights,
                                    QStringList localVersions,
                                    QList<qint64> localWeights);
    void setDownloaded(QString file, quint8 osType, qint64 size);
    void setDownloadComplete(QString file, quint8 osType, bool success);
public slots:
    void refreshClientAvaliableUsers(QStringList usr);
    void refreshClientCurrentUsers(QStringList usr);
    void setRoomList(QList<QMap<int, QVariant> > lst);
signals:
    void avaliableRoomsChanged();
    void addLang(FKQmlArgument lng, FKQmlArgument lngLbl);
    void langRequest();
    void toMainMenuRequest();
    void fromMainMenuRequest();
    void toClientMenuRequest();
    void fromClientMenuRequest();
    void toUserMenuRequest();
    void fromUserMenuRequest();
    void toRoomListRequest();
    void fromRoomListRequest();
    void toAppUpdateMenuRequest();
    void fromAppUpdateMenuRequest();
    void languageChosen(FKQmlArgument lng);
    void managerRequested(QString managerType, QString ip, int port);
    void createUserRequested(QString userName);
    void deleteUserRequested(QString userName);
    void addUserRequested(QString userName);
    void removeUserRequested(QString userName);
    void usersApply();
    void createRoomRequested(QString roomType,QString roomName,QString roomDescription,QString roomPassword);
    void enterRoomRequested(qint32 roomID);
    void updateRoomList();
    void genClientRequested(QString clientName, QString password, QVariant validator);
    void chooseClientRequested(QString clientName, QString password);
    void downloadInterruptionRequested();
    void appFilesReplace(QStringList lst,QList<quint8> os);
    void appFileUpdate(QString fl, quint8 osType);
protected:
    void setupDefaults();
    void setupContextProperties(QQmlContext* context);
private slots:
    void localManagerRequested();
    void serverManagerRequested(FKQmlArgument port);
    void clientManagerRequested(FKQmlArgument ip, FKQmlArgument port);
    void resetManagerRequested();
    void createUserRequest(FKQmlArgument userName);
    void deleteUserRequest(FKQmlArgument userName);
    void addUserRequest(FKQmlArgument userName);
    void removeUserRequest(FKQmlArgument userName);
    void createRoomRequest(FKQmlArgument roomType,FKQmlArgument roomName,FKQmlArgument roomDescription,FKQmlArgument roomPassword);
    void enterRoomRequest(FKQmlArgument roomID);
    void genClientRequest(FKQmlArgument clientName, FKQmlArgument password, FKQmlArgument validator);
    void chooseClientRequest(FKQmlArgument clientName, FKQmlArgument password);
    void skipRequest();
    void downloadRequest();
    void restartRequest();
private:
    FKVisualInterfaceView* initialization(QWindow* parent);
    QStringListModel* _currentUsersModel;
    QStringListModel* _avaliableUsersModel;
    FKQuickRowModel* _roomList;
    FKAppVersionModel* _appVersionModel;
    QSortFilterProxyModel* _filterModel;
    QStringList _avaliableRoomTypes;
};

#endif // FKMENUINTERFACE_H
